package com.common.help;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test2 {

	public static void main(String[] args) {
		
		ExecutorService service = Executors.newCachedThreadPool();
		for(int i=0;i<50;i++){
			service.execute(new ThreadRunable(i));
		}
		service.shutdown();
	}
}

class ThreadRunable implements Runnable{
	
	final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");

	private int num;
	
	public ThreadRunable(int num){
		this.num = num;
	}
	@Override
	public void run() {
		System.out.println(Thread.currentThread().getName()+"  time:"+sdf.format(new Date())+"  num:"+num);
	}
	
}